package com.wx.wxapp.controller;

import com.wx.wxapp.service.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class ActivityController {
    @Autowired
    private ActivityService activityService;

    @RequestMapping(value = "/createActivity",method = RequestMethod.POST)
    public void CreateActivity(@RequestParam("title")String title,@RequestParam("address")String address,
                               @RequestParam("information")String information,@RequestParam("time")String time,
                               @RequestParam("petId")int petId){
        activityService.CreateActivity(title,address,information,time,petId);
    }

    @RequestMapping(value = "/joinActivity",method = RequestMethod.POST)
    public void JoinActivity(@RequestParam("activityId")String activityId,@RequestParam("petId")int petId){
        activityService.JoinActivity(activityId,petId);
    }
    @RequestMapping(value = "/exitActivity",method = RequestMethod.POST)
    public void ExitActivity(@RequestParam("petId")int petId){
        activityService.ExitActivity(petId);
    }

    @RequestMapping(value = "/getActivity",method = RequestMethod.GET)
    public Map GetActivity(@RequestParam("activityId")String activityId){
        return activityService.GetActivity(activityId);
    }

    @RequestMapping(value = "getPetActivityId",method = RequestMethod.GET)
    public String GetPetActivityId(int petId){
        return  activityService.GetPetActivityId(petId);
    }
}
